IUTextOrder
IUTextOrder Compare raw text using specified scripts
#include <Packages.h> International Utilities Package
short IUTextOrder(aPtr,bPtr, aLen,bLen, aScript, bScript,
aLang, bLang);
const void *aPtr ; addresses of ...
const void *bPtr ; ... text to compare
short aLen ; length of aPtr, in bytes
short bLen ; length of bPtr, in bytes
ScriptCode aScript ; code indicating first script
ScriptCode bScript ; code indicating second script
LangCode aLang ; code indicating first language
LangCode bLang ; code indicating second language
returns -1 if (ab)
Given a pair of strings defined by a pointer and character length (with a
script and language code for each), IUTextOrder indicates the proper sorting
order of the strings
aPtr and . . .
bPtr are the addresses of text to be compared.
aLen is the length, in bytes, of the text pointed to by aPtr
bLen is the length, in bytes, of the text pointed to by bPtr
aScript and . . .
bScript are the script codes of the scripts to be compared.
aLang and . . .
bLang are the language codes of the languages to be compared.
Returns: a short, which describes the collating relationship of the text
pointed to by aPtrand the text pointed to by bPtr It is one of:
-1 aPtr is less than bPtr
0 aPtr and bPtr are equal
1 aPtris greater than bPtr

Notes: The IUStringOrder and IUTextOrder functions are similar to the
IUCompString and IUMagString functions, except that they take a
script and language code for each string. IUStringOrder and
IUTextOrder use IUScriptOrder, IULangOrder, and IUMagPString
to return -1, 0, or 1, indicating the proper ordering of strings that may be
in different scripts or languages. If the result of
IUScriptOrder( aScript, bScript) is not 0, then it is returned as the
result of IUStringOrder or IUTextOrder. If the result is 0, aLang and
bLang are checked; if these are different, then they determine the function
result. If they are not different, the strings are in the same script and
language and are compared using the sorting for that script and language. If
that script is not installed and enabled, the sorting is performed using the
script specified by IntlScript.
The IUStringOrder and IUTextOrder functions are primarily used to
insert strings in a sorted list; for sorting, it may be faster to sort first by
script and language by using the IUScriptOrder and IULangOrder
functions, and then to call IUCompPString to sort strings within a script
or language group.
With System 7.0, the new IUScriptOrder, IULangOrder,
IUStringOrder, IUTextOrder, and IUGetItlTable routines accept
special script or language codes. These script and language codes facilitate
the process of sorting text between scripts and languages. For these
routines, System 7.0 has defined these new types: ScriptCode and
LangCode. A valid ScriptCode type can be an integer in the range 0-64
that explicitly indicates a particular script, or it can be a negative value
with a special meaning. A valid LangCode type can be a nonnegative integer
that explicitly indicates a particular language, or it can be a negative value
with a special meaning.
The data types ScriptCode and LangCode are defined as follows:
typedef short ScriptCode;
typedef short LangCode;
Valid values for a parameter of type ScriptCode are integers in the range
0-64 that explicitly indicate a particular script, or one of the following
negative values:
Constant Meaning
iuSystemScript System script
iuCurrentScript Current script (from FontScript)
A valid value for a parameter of type LangCode is a nonnegative integer
that explicitly indicates a particular language, or is one of the following
negative values:
Constant Meaning
iuSystemCurLang Current language for system script (from script
global variables)
iuSystemDefLang Default language for system script (from 'itlm'
resource)
iuCurrentCurLang Current language for current script (from script
global variables)
iuCurrentDefLang Default language for current script (from 'itlm'
resource)
iuScriptCurLang* Current language for specified script (from script
global variables)
iuScriptDefLang Default language for specified script (from 'itlm'
resource)
*The International Utilities Package can not determine the current
language if the script system is not installed,, in this case it uses the
default language.
Not all of the routines that have ScriptCode or LangCode parameters
support all of the special negative values; the exceptions are noted in
relevant routine de scriptions. For details see the sections entitled
Accessing the International Resources.
For all of these sorting functions, invalid script or language codes are
sorted after valid ones. Note that these functions can move memory.